package com.zqx.observer.client;

import com.zqx.observer.abstractobserver.Observer;
import com.zqx.observer.abstracttarget.AllyControllerCenter;
import com.zqx.observer.specficobserver.Player;
import com.zqx.observer.specifictarget.ConcreteAllyControllerCenter;

/**
 * description: 客户端测试
 * @author zqx
 * @date 2018/09/04
 */
public class Client {

    public static void main(String[] args) {
        //定义观察目标对象
        AllyControllerCenter acc;
        acc = new ConcreteAllyControllerCenter("张玉娜");

        //定义4个观察者对象
        Observer player1,player2,player3,player4;
        player1 = new Player("谦行1");
        acc.join(player1);
        player2 = new Player("谦行2");
        acc.join(player2);
        player3 = new Player("谦行3");
        acc.join(player3);
        player4 = new Player("谦行4");
        acc.join(player4);

        //某成员遭受攻击
        player1.beAttacked(acc);
    }
}
